/*
 SGSortingGameLevel.h
 Date Created: March 6, 2010
 
 Authors: Karanvir Gill <viper1029@gmail.com>
          Frank Lau <flaua@sfu.ca>
 
 Copyright (C) 2010 Green-Power
 
 URL: http://code.google.com/p/green-power
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
 $Id$
 */

#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>

#import "SGRecyclableType.h"
#import "SGRecyclableItem.h"

@class SGSortingGame;

/**
 * This class contains all the information associated with a particular level
 */
@interface SGSortingGameLevel : NSManagedObject {
}

@property (nonatomic) NSUInteger level;
@property (nonatomic) NSUInteger livesLeft;
@property (nonatomic) NSUInteger score;

@property (nonatomic) NSUInteger numItemsDisplayed;
@property (nonatomic) NSUInteger numItemsDroppedInWrongBin;
@property (nonatomic) NSUInteger numItemsDroppedInCorrectBin;
@property (nonatomic) NSUInteger totalNumItems;

@property (nonatomic,retain) SGSortingGame *owner;

/**
 * Calculates the speed of the items on the conveyor belt in this level
 *
 * \return Speed of the conveyor belt
 */
- (float)speedOfItems;

/**
 * Increments the score, updating the owner
 *
 * \param score The amount to increment the score by
 */
- (void)incrementScore:(NSUInteger)score;

/**
 * \return Overall level sorting accuracy
 */
- (float)accuracy;

/**
 * Changes stastics, updating the owner and number of lives left.
 *
 * \param correctly Indicates whether the item was dropped into the correct bin.
 */
- (void)itemDropped:(BOOL)correctly;

/**
 * Returns an array containing the item types that are avaliable in the current 
 * level
 *
 * \return The avaliable item types in the current level
 */
- (NSArray *)listItemsInLevel;

/**
 * Returns a possible item that can be displayed in this level. The item is 
 * chosen at random from the array returned by SGSortingGameLevel#listItemsInLevel
 *
 * |numItemsDisplayed| is incremented as a result of this
 * 
 * Nil is returned if |numItemsDisplayed| == |totalNumItems|
 *
 * \return Item type
 */
- (SGRecyclableItem *)popNextItem;

@end
